package com.ruoyi.project.gxgw_modules.depositOrder.controller;

import java.util.List;

import com.ruoyi.project.gxgw_modules.depositOrder.vo.DepositOrderVO;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.framework.aspectj.lang.annotation.Log;
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
import com.ruoyi.project.gxgw_modules.depositOrder.domain.DepositOrder;
import com.ruoyi.project.gxgw_modules.depositOrder.service.IDepositOrderService;
import com.ruoyi.framework.web.controller.BaseController;
import com.ruoyi.framework.web.page.TableDataInfo;
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;

/**
 * 寄放订单管理 信息操作处理
 * 
 * @author ruoyi
 * @date 2019-01-18
 */
@Controller
@RequestMapping("/gxgw_modules/depositOrder")
public class DepositOrderController extends BaseController
{
    private String prefix = "gxgw_modules/depositOrder";
	
	@Autowired
	private IDepositOrderService depositOrderService;
	
	@RequiresPermissions("gxgw_modules:depositOrder:view")
	@GetMapping()
	public String depositOrder()
	{
	    return prefix + "/depositOrder";
	}
	
	/**
	 * 查询寄放订单管理列表
	 */
	@RequiresPermissions("gxgw_modules:depositOrder:list")
	@PostMapping("/list")
	@ResponseBody
	public TableDataInfo list(DepositOrder depositOrder)
	{
		startPage();
        List<DepositOrderVO> list = depositOrderService.selectDepositOrderList(depositOrder);
		return getDataTable(list);
	}
	
	
	/**
	 * 导出寄放订单管理列表
	 */
	@RequiresPermissions("gxgw_modules:depositOrder:export")
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(DepositOrder depositOrder)
    {
    	List<DepositOrderVO> list = depositOrderService.selectDepositOrderList(depositOrder);
        ExcelUtil<DepositOrderVO> util = new ExcelUtil<DepositOrderVO>(DepositOrderVO.class);
        return util.exportExcel(list, "depositOrder");
    }
	
	/**
	 * 新增寄放订单管理
	 */
//	@GetMapping("/add")
//	public String add()
//	{
//	    return prefix + "/add";
//	}
	
	/**
	 * 新增保存寄放订单管理
	 */
//	@RequiresPermissions("gxgw_modules:depositOrder:add")
//	@Log(title = "寄放订单管理", businessType = BusinessType.INSERT)
//	@PostMapping("/add")
//	@ResponseBody
//	public AjaxResult addSave(DepositOrder depositOrder)
//	{
//		return toAjax(depositOrderService.insertDepositOrder(depositOrder));
//	}

	/**
	 * 修改寄放订单管理
	 */
//	@GetMapping("/edit/{depositId}")
//	public String edit(@PathVariable("depositId") Integer depositId, ModelMap mmap)
//	{
//		DepositOrder depositOrder = depositOrderService.selectDepositOrderById(depositId);
//		mmap.put("depositOrder", depositOrder);
//	    return prefix + "/edit";
//	}
	
	/**
	 * 修改保存寄放订单管理
	 */
//	@RequiresPermissions("gxgw_modules:depositOrder:edit")
//	@Log(title = "寄放订单管理", businessType = BusinessType.UPDATE)
//	@PostMapping("/edit")
//	@ResponseBody
//	public AjaxResult editSave(DepositOrder depositOrder)
//	{
//		return toAjax(depositOrderService.updateDepositOrder(depositOrder));
//	}
	
	/**
	 * 删除寄放订单管理
	 */
	@RequiresPermissions("gxgw_modules:depositOrder:remove")
	@Log(title = "寄放订单管理", businessType = BusinessType.DELETE)
	@PostMapping( "/remove")
	@ResponseBody
	public AjaxResult remove(String ids)
	{
		return toAjax(depositOrderService.deleteDepositOrderByIds(ids));
	}
	
}
